function [BigEnough adjust] = checkScreen
% Checks the screen size and gives an indication on whether or not the
% screen meets the minimal requirements for the GUI by returning a
% 1 (meets reqs.) or 0 (fails reqs.)

%% Get screensize
adjust = 0;
ScrSz = get(0, 'MonitorPosition'); % MonitorPosition is used b/c it's dynamic
% ScreenSize only shows the maximum screen resolution, not the current one.
ScrSz = ScrSz(1,3:4);
%% Loading known Screenresolutions
if exist('ScreenResos.mat','file') == 2
    load('ScreenResos.mat') %A file with most common display resolutions
    %% check for common display resolution
    for k = 1:length(ScreenData)
        if ScrSz == ScreenData(k,1:2)
            disp('Found common display resolution')
            disptext = sprintf('Resolution: %d x %d',ScreenData(k,1),...
                ScreenData(k,2));
            disp(disptext)
            if ScrSz(1) > ScrSz(2)
                % Uses the smallest as a multiplier for the GUI size
                adjust = [0.9*ScrSz(2) 0.9*ScrSz(2)]/800; 
            else
                adjust = [0.9*ScrSz(1) 0.9*ScrSz(1)]/800;
            end
            BigEnough = 1; % And tells LoadSMILES a GUI is possible
            break
        end
    end
    %% Uncommon display resolution:
    if adjust == 0
        if ScrSz >= [500,500] %In case an uncommon display resolution is ued
            BigEnough = 1; % It still meets minimal sys req :)
            disp('No common display resolution found')
            if ScrSz(1) > ScrSz(2)
                adjust = [0.9*ScrSz(2) 0.9*ScrSz(2)]/800; %See above
            else
                adjust = [0.9*ScrSz(1) 0.9*ScrSz(1)]/800;
            end
        else
            BigEnough = 0;
            disp('Screen resolution does not meet system requirements')
        end
    end
%%
else
    disp('File missing: ScreenResos.mat')
    % In case someone deleted ScreenResos.mat; We know this application
    % wouldn't need it, but you're not permitted to delete files in it...
    BigEnough = 0; % Thus: No GUI for you! Muahahahaha :P
end

end